package com.nbpt;

import android.app.Activity;
import android.database.Cursor;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import com.nbpt.db.AccountDBHelp;

import static com.nbpt.SmartCity.userid;

public class yonghunichen extends Activity {
    TextView usertext;
    EditText nc;
    Button button;
    AccountDBHelp helper;
    Cursor cursor;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_yonghunichen);

        nc=findViewById(R.id.nicheng);
        button=findViewById(R.id.baocun);

        helper = new AccountDBHelp(yonghunichen.this,AccountDBHelp.VERSION_1);
        cursor = helper.select(null,null);
        cursor.move(Integer.parseInt(SmartCity.userid));
        nc.setText(cursor.getString(4));
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                helper.update(cursor.getString(0),nc.getText().toString());
                Toast.makeText(yonghunichen.this,"修改完成",Toast.LENGTH_SHORT).show();
                finish();
            }
        });
    }
}
